<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="pg" uri="http://jsptags.com/tags/navigation/pager"%>
<%
	String url = request.getParameter("url");
	int total = Integer.valueOf(request.getParameter("items"));
%>

<style type="text/css">
.container {
	background: #fdfdfd;
	padding: 1rem;
	margin: 3rem auto;
	border-radius: 0.2rem;
	counter-reset: pagination;
	text-align: center;
}

.container:after {
	clear: both;
	content: "";
	display: table;
}

.container ul {
	width: 100%;
}

.large {
	width: 45rem;
}

.pagination ul, li {
	list-style: none;
	display: inline;
	padding-left: 0px;
}

.pagination li {
	counter-increment: pagination;
}

.pagination li:hover a {
	color: #fdfdfd;
	background-color: #1d1f20;
	border: solid 1px #1d1f20;
}

.pagination li a {
	border: solid 1px #d6d6d6;
	border-radius: 0.2rem;
	color: #7d7d7d;
	text-decoration: none;
	text-transform: uppercase;
	display: inline-block;
	text-align: center;
	padding: 0.5rem 0.9rem;
}

.li a {
	display: inline-block;
}
</style>

<div class="container large">
	<div class="pagination">
		<pg:pager url="<%=url%>" items="<%=total%>" maxPageItems="5"
			maxIndexPages="15" export="currentPageNumber=pageNumber">
			<pg:first>
				<li><a href="${pageUrl }">首页</a></li>
			</pg:first>
			<pg:prev>
				<li><a href="${pageUrl }">上一页</a></li>
			</pg:prev>
			<pg:pages>
				<c:choose>
					<c:when test="${currentPageNumber eq pageNumber}">
						<li><a><font color="red">${pageNumber }</font></a></li>
					</c:when>
					<c:otherwise>
						<li><a href="${pageUrl }">${pageNumber }</a></li>
					</c:otherwise>
				</c:choose>
			</pg:pages>
			<pg:next>
				<li><a href="${pageUrl }">下一页</a></li>
			</pg:next>
			<pg:last>
				<li><a href="${pageUrl }">尾页</a></li>
			</pg:last>
		</pg:pager>
	</div>
</div>